/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cliente;

import java.io.File;
import java.io.FileNotFoundException;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.Enumeration;
import java.util.Scanner;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author italo
 */
public class Teste {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {

        String projectPath = System.getProperty("user.dir");
        
        try {
            Scanner scanner = new Scanner(new File(projectPath + "/servidor.txt"));

            String servidorIp = scanner.next();

            System.out.println( servidorIp );


            String servidorPort = scanner.next();

            System.out.println( servidorPort );
        } catch (FileNotFoundException ex) {
            Logger.getLogger(Teste.class.getName()).log(Level.SEVERE, null, ex);
        }

    }

    private static void getIp() {
        try {
            // obtem a lista de interfaces
            Enumeration<NetworkInterface> NetIfaceEnum = NetworkInterface.getNetworkInterfaces();
            while (NetIfaceEnum.hasMoreElements()) {
                NetworkInterface networkInterface = NetIfaceEnum.nextElement();
                // para cada interface, obtem a lista de enderecos
                Enumeration<InetAddress> inetAddressEnum = networkInterface.getInetAddresses();
                while (inetAddressEnum.hasMoreElements()) {
                    InetAddress inetAddress = inetAddressEnum.nextElement();
                    if (!inetAddress.isLoopbackAddress() && inetAddress.toString().length() <= 16) {
                        System.out.println("valor:_" + inetAddress + "\n");
                    }
                }
            }
        } catch (SocketException ex) {
            Logger.getLogger(Teste.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}
